#pragma warning disable 0618
using System;
using System.Collections.Generic;
using Table.DataModel;
namespace Table.Dao
{
    public class TableSceneEventDao:DaoBase<TableSceneEvent>
    {
        public override string GetFileName()
        {
            return "TableSceneEvent.csv";
        }
        public override void BuildIndex()
        {
            if (cacheList != null)
            {
                cachePrimary = new Dictionary<string, TableSceneEvent>(cacheList.Count);
            }
            base.BuildIndex();
        }
        public override void AddPrimaryIndex(TableSceneEvent model)
        {
            #if UNITY_EDITOR
            if(cachePrimary.ContainsKey(model.eventName)) UnityEngine.Debug.LogError("数据表id重复:TableSceneEvent->id: " + model.eventName);
            #endif
            cachePrimary[model.eventName] = model;
        }
        protected override TableSceneEvent ParseRowData(string[] rowData)
        {
            TableSceneEvent data = new TableSceneEvent();
            if (!string.IsNullOrEmpty(rowData[0]))
            {
                data.eventName = string.Intern(rowData[0]);
            }
            if (!string.IsNullOrEmpty(rowData[1]))
            {
                data.eventId = int.Parse(rowData[1]);
            }
            if (!string.IsNullOrEmpty(rowData[2]))
            {
                data.eventType = int.Parse(rowData[2]);
            }
            if (!string.IsNullOrEmpty(rowData[3]))
            {
                data.checkDistance = int.Parse(rowData[3]);
            }
            return data;
        }
    }
}
